@@ -12,6 +12,7 @@ from paginator import pagination |
||
| 12 | 12 |
from TimeConvert import TimeConvert as tc |
| 13 | 13 |
|
| 14 | 14 |
from account.models import UserInfo |
| 15 |
+from mch.models import ModelInfo |
|
| 15 | 16 |
from maintenance.models import ExpressCompanyInfo, MaintenaceInfo |
| 16 | 17 |
from pre.custom_message import sendtemplatemessage |
| 17 | 18 |
from utils.admin_utils import is_admin, is_maintenanceman |
@@ -241,34 +242,36 @@ def maintenance_status_update_sendtemplatemessage(maintenance): |
||
| 241 | 242 |
except UserInfo.DoesNotExist: |
| 242 | 243 |
return |
| 243 | 244 |
|
| 245 |
+ model = ModelInfo.objects.get(model_id=maintenance.model_id) |
|
| 246 |
+ user = UserInfo.objects.get(user_id=maintenance.user_id) |
|
| 244 | 247 |
# Send template_message |
| 245 |
- # data = {
|
|
| 246 |
- # "first": {
|
|
| 247 |
- # "value": u'你的补码申请已通过,请点击消息绑定您的电子保修卡', |
|
| 248 |
- # "color": "#173177" |
|
| 249 |
- # }, |
|
| 250 |
- # "keyword1": {
|
|
| 251 |
- # "value": log.name, |
|
| 252 |
- # "color": "#173177" |
|
| 253 |
- # }, |
|
| 254 |
- # "keyword2": {
|
|
| 255 |
- # "value": log.model_name, |
|
| 256 |
- # "color": "#173177" |
|
| 257 |
- # }, |
|
| 258 |
- # "keyword3": {
|
|
| 259 |
- # "value": log.sn, |
|
| 260 |
- # "color": "#173177" |
|
| 261 |
- # }, |
|
| 262 |
- # "remark": {
|
|
| 263 |
- # "value": u'感谢您的使用', |
|
| 264 |
- # "color": "#173177" |
|
| 265 |
- # } |
|
| 266 |
- # } |
|
| 267 |
- # |
|
| 268 |
- # wxcfg = WECHAT.get('MINIAPP', {})
|
|
| 269 |
- # appid = wxcfg.get('appID')
|
|
| 270 |
- # |
|
| 271 |
- # sendtemplatemessage(openid=user.openid, template_id=settings.TEMPLATE_ID_COMPLEMENT, data=data, miniappid=appid, minipagepath='/pages/register/consumer/consumer?q={}&marketcode=1'.format(ciphertext))
|
|
| 248 |
+ data = {
|
|
| 249 |
+ "first": {
|
|
| 250 |
+ "value": u'您的维修状态已更新', |
|
| 251 |
+ "color": "#173177" |
|
| 252 |
+ }, |
|
| 253 |
+ "keyword1": {
|
|
| 254 |
+ "value": model.model_name, |
|
| 255 |
+ "color": "#173177" |
|
| 256 |
+ }, |
|
| 257 |
+ "keyword2": {
|
|
| 258 |
+ "value": maintenance.sn, |
|
| 259 |
+ "color": "#173177" |
|
| 260 |
+ }, |
|
| 261 |
+ "keyword3": {
|
|
| 262 |
+ "value": maintenance.maintenance_status, |
|
| 263 |
+ "color": "#173177" |
|
| 264 |
+ }, |
|
| 265 |
+ "remark": {
|
|
| 266 |
+ "value": u'如您有任何其他疑问,可在腾龙公众号进行留言', |
|
| 267 |
+ "color": "#173177" |
|
| 268 |
+ } |
|
| 269 |
+ } |
|
| 270 |
+ |
|
| 271 |
+ wxcfg = WECHAT.get('MINIAPP', {})
|
|
| 272 |
+ appid = wxcfg.get('appID')
|
|
| 273 |
+ |
|
| 274 |
+ sendtemplatemessage(openid=user.openid, template_id=settings.TEMPLATE_ID_COMPLEMENT, data=data, miniappid=appid, minipagepath='/pages/index/index') |
|
| 272 | 275 |
|
| 273 | 276 |
|
| 274 | 277 |
def is_maintenance_tracking_signed(tracking_info): |
@@ -277,7 +280,7 @@ def is_maintenance_tracking_signed(tracking_info): |
||
| 277 | 280 |
items = tracking_info.get('data', [])
|
| 278 | 281 |
if not items: |
| 279 | 282 |
return False |
| 280 |
- return items[0].get('status') == u'签收'
|
|
| 283 |
+ return items.get('state') == u'3'
|
|
| 281 | 284 |
|
| 282 | 285 |
|
| 283 | 286 |
def maintenance_tracking_info_update(maintenance, type_, tracking_info): |